﻿@{
    ViewBag.Title = "短信任务周期统计";
    Layout = "~/Views/Shared/_layer.cshtml";
}


<form id="form1" class="form-horizontal">
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box-body">
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover body-table-head">
                            <colgroup>
                                <col style="width:10%" />
                                <col style="width:10%" />
                                <col style="width:10%" />
                            </colgroup>
                            <thead>
                                <tr>
                                    <th>发送时间</th>
                                    <th>发送数量</th>
                                    <th>下次发送时间</th>
                                </tr>
                            </thead>
                            <tbody id="tbodylist"></tbody>
                        </table>
                        <div class="no-data" id="nodata" style="display:none;">
                            <div class="img-box"></div>
                            <div class="text">暂无数据</div>
                        </div>
                    </div>
                    <div class="box-footer clearfix ">
                        <ul id="pagination" class="pagination pagination-sm no-margin pull-right"></ul>
                    </div>
                </div>
             
            </div>

        </div>
        <!-- /.row -->
    </section>

</form>
@section scriptsBottom{
<script src="@Url.Content("~/lib/art-template/template-web.js")"></script>
<script id="dataItemTpl" type="text/html">
    {{each rows}}
    <tr>
        <td class="title">
            {{$value.CreatedTime}}
        </td>
        <td class="title">
            {{$value.RealSendCount}}
        </td>
        {{if $value.NextSendTime=='0001-01-01 00:00:00'}}
        <td class="title"></td>
        {{else}}
        <td class="title">
            {{$value.NextSendTime}}
        </td>
        {{/if}}
     
    </tr>
    {{/each}}
</script>
    <script type="text/javascript">
       $(document).ready(function () {
        
           list();
       });

       //页码
       var pageIndex = 1;
       //查询
       function list() {
           var tid = @ViewBag.TaskTimeId;
           var url = '@Url.Action("SearchTaskTimeStatsticsList", "Sms")' + "?page=" + pageIndex + "&rows=10";
           //查询列表
           BMCW.ajax({
               url: url,
               type: 'POST',
               dataType: "json",
               data: {
                   tid: tid
               },
               success: function (dt) {
                   if (dt.total < 1) {
                       $("#nodata").show();
                       document.getElementById('tbodylist').innerHTML = "";
                       return;
                   }
                   $("#nodata").hide();
                   //模板渲染
                   var data = dt.rows;
                   var html = template('dataItemTpl', dt);
                   document.getElementById('tbodylist').innerHTML = html;

                   //分页显示
                   $('#pagination').twbsPagination("destroy");
                   $('#pagination').twbsPagination({
                       totalItems: dt.total,
                       visiblePages: 10,
                       pageSize: 10,
                       startPage: parseInt(pageIndex),
                       onPageClick: function (event, page) {
                           pageIndex = page;
                           list();
                       }
                   });
               }
           });
       }
    </script>
}
